package com.heima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.pojo.entity.Region;
import com.heima.pojo.dto.RegionDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface RegionMapper extends BaseMapper<Region> {
    //区域分页查询 动态查询名字不是必须
    List<Region> getRegions(String name);

    //新建区域
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into tb_region (name ,remark) VALUES (#{name},#{remark})")
    Boolean save(RegionDto regionDto);

    //修改区域
    Boolean update(String id ,Region region);
}
